package hihocoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

/**
 * 
 */

/**
 * @author zhongfang
 *
 */
public class 小Hi和小Ho的礼物 {

	static class Node{
		public Node(int i2, int j2) {
			this.i=i2;
			this.j=j2;
		}
		int i;
		int j;
		public boolean okWith(Node tmpNode) {
			if(this.i!=tmpNode.i&&this.j!=tmpNode.i&&this.i!=tmpNode.j&&this.j!=tmpNode.j)
				return true;
			return false;
		}
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		int N=scanner.nextInt();
		int[] A=new int[N];
		for (int i = 0; i < A.length; i++) {
			A[i]=scanner.nextInt();
		}
		HashMap<Integer, ArrayList<Node>> map=new HashMap<>();
		for (int i = 0; i < A.length; i++) {
			for (int j = i+1; j < A.length; j++) {
				int sum=A[i]+A[j];
				if(map.containsKey(sum)){
					map.get(sum).add(new Node(i,j));
				}else {
					ArrayList<Node> list=new ArrayList<>();
					list.add(new Node(i, j));
					map.put(sum, list);
				}
			}
		}
		
		int result=0;
		for (ArrayList<Node>  list: map.values()) {
			for (int i = 0; i < list.size(); i++) {
				Node curNode=list.get(i);
				for (int j = i+1; j < list.size(); j++) {
					Node tmpNode=list.get(j);
					if(curNode.okWith(tmpNode)){
						result++;
					}
				}
			}
		}
		System.out.println(2*result);
	}

}
